<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div>
    <button onclick="doget()">axios.get()</button>
    <button onclick="doget1()">axios.get(...)</button>
    <button onclick="dopost()">axios.post</button>
</div>
</body>
<script src="js/axios.min.js"></script>
<script>
    function dopost() {
        let url="/doPost";
        let param ={"id":1,"name":"xiaomi","letter":"x"};
        //let param="id=1&name=xiaomi&letter=x"
        axios.post(url,param)
            .then(function (result) {
                console.log(result.data);
            })
            .catch(function (result) {
                console.log(result.data);
            });
    }
    function doget() {
        let url="/doGet";
        axios.get(url)
            .then(function (result) {
                console.log(result.data);
            })
            .catch(function (result) {
                console.log(result);
            });

    }

    function doget1() {
        let url="/doajax";
        axios.get(url,{
            params:{
                msg:"hello"
            }
        })
            .then(function (result) {
                console.log(result.data);
            })
            .catch(function (result) {
                console.log(result);
            });

    }
</script>
</html>